<!DOCTYPE html>

<html lang="zh-CN">
<head>
	<meta charset="utf-8">
	<!--
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    -->
	<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
	<meta name="x5-page-mode" content="app" />
	<!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
	<title>营业员激励系统</title>

	<!-- Bootstrap -->
	<link href="//cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">

	<link href="script/swiper-3.3.1.min.css" rel="stylesheet">

	<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
	<script src="//cdn.bootcss.com/jquery/1.12.1/jquery.js"></script>
	<!-- Include all compiled plugins (below), or include individual files as needed -->
	<script src="//cdn.bootcss.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
	<script type="application/javascript" src="layer_mobile/layer.js"></script>
	<script type="application/javascript" src="layer_mobile/need/layer.css"></script>


	<script src="script/countUp.js"></script>
	<script src="script/echarts.min.js"></script>


	<script>


		var moneyToday=0;
		var moneyWeek=0;
		var moneyTotal=0;
		var orderToday=0;
		var rank=999999;

		$(
			function (){

				$.ajax({
					url:"/userIndex",
					type:"post",
					async:false,
					success:function(data){
						if(data.indexOf("success")>=0){
							data = data.substring(8);
							var array = data.split(",");
							$("#displayName").html("<b>欢迎您:"+array[2]+"</b>");
							moneyToday = array[0];
							moneyWeek = array[1];
							orderToday = array[4];
							moneyTotal = array[3];
							rank=array[5];
						}else{
							if(data.indexOf("relogin")>=0){
								window.location.href = "/login.html";
							}
						}
					}
				});

				//初始化数字控件
				var moneyTodayNumber = new CountUp("moneyToday", 0,moneyToday, 2, 2.5);
				moneyTodayNumber.start();

				var moneyWeekNumber = new CountUp("moneyWeek", 0,moneyWeek, 2, 2.5);
				moneyWeekNumber.start();

				var moneyTotalNumber = new CountUp("moneyTotal", 0,moneyTotal, 2, 2.5);
				moneyTotalNumber.start();

				var orderTodayNumber = new CountUp("orderToday", 0,orderToday, 0, 3);
				orderTodayNumber.start();

				var rankNumber = new CountUp("rank", 999,rank, 0, 2);
				rankNumber.start();

				//初始化发展曲线图
				option = {
					title : {
						text: '一周发展用户曲线',
						subtext: '纯属虚构'
					},
					tooltip : {
						trigger: 'axis'
					},
					legend: {
						data:['用户数']
					},
					toolbox: {
						show : true,
						feature : {
							mark : {show: true},
							dataView : {show: true, readOnly: false},
							magicType : {show: true, type: ['line', 'bar']},
							restore : {show: true},
							saveAsImage : {show: true}
						}
					},
					calculable : true,
					xAxis : [
						{
							type : 'category',
							boundaryGap : false,
							data : ['6月16日','6月17日','6月18日','6月19日','6月20日','6月21日','6月22日']
						}
					],
					yAxis : [
						{
							type : 'value',
							axisLabel : {
								formatter: '{value}'
							}
						}
					],
					series : [

						{
							name:'f',
							type:'line',
							data:[20,24,22,30,45,26,33]
						}
					]
				};

				var myChart = echarts.init(document.getElementById('main'));

				myChart.setOption(option);

			}

		);





    </script>


</head>
<body class="container">



	<div >

		<div class=" panel panel-default" >
			<div class="row panel-body background-color:#FF9933;color:white">
				<div class="col-xs-12" >
					<div class="row" style="background-color:#FF9933;color:white">
						<div class="col-xs-10  ">
						<span style="color:white"><h5><b>营业员激励支撑系统 <span style="color:white" id="displayName"><b>欢迎您:</b></span>
							</b></h5></span>
						</div>
						<div class="col-xs-2 pull-right text-right" >
							<span style="color:white"><h5><b><a  style="color:white" href="login.html">退出</a></b></h5></span>

						</div>

					</div>
					<div class="row" style="background-color:#FF9933">
						<div class="col-xs-12 center-block text-center ">

							<span style="color:white"><h6>今日红包<span style="font-size:25px" id="moneyToday"></span>  （元）</h6></span>




							<span style="color:white" id="pcount"><h6>发展<span style="font-size:25px" id="orderToday"></span>个用户<a href="javascript:viewDetail()" style="color:white">（查看明细）</a></h6><h6>（ 第<span style="font-size:25px" id="rank"></span>名）</h6></span>
							<script>
							function viewDetail(){
								window.location.href="/record_detail.html";
							}
						</script>

						</div>
					</div>

				</div>
			</div>
		</div>


		<div class=" panel panel-default" >
			<div class="row panel-body">
				<div class="col-xs-6 text-center" >
					<span style="color:#FF9933"><h3><span id="moneyWeek">888</span></h3></span>
					<span style="color:#666666"><h5><span>一周红包(元)</span></h5></span>
				</div>
				<div class="col-xs-6 text-center">
					<span style="color:#FF9933"><h3><span id="moneyTotal">888</span></h3></span>
					<span style="color:#666666"><h5><span>累计红包(元)</span></h5></span>
				</div>
			</div>
		</div>

		<div class=" panel panel-default" >

			<div class="row panel-body text-center">
				<div id="main" style="width: 100%;height:400px;"></div>
			</div>
		</div>

	</div>

	<footer>
		<nav class="navbar navbar-default  navbar-fixed-bottom " role="navigation">



			<div class="navbar-header col-xs-12">
				<a href="javascript:addNew()">
					<button type="button" class="btn btn-block btn-warning btn-lg glyphicon glyphicon-shopping-cart" >发展新用户</button>
					<script>
						function addNew(){
							window.location.href="/record_form.html";
						}
					</script>

				</a>
			</div>

		</nav>
	</footer>




</body>
</html>